package org.particlethink.response;

import com.alibaba.excel.annotation.ExcelProperty;
import org.particlethink.model.*;

import java.text.SimpleDateFormat;

public class OrderExportResponse {
    @ExcelProperty("管理层级")
    private String managementLevel; //管理层级
    @ExcelProperty("所属项目")
    private String projectName; //管理层级

    @ExcelProperty("订单单号")
    private String no;
    @ExcelProperty("批次计划单号")
    private String batchPlanNo;

    @ExcelProperty("物料大类")
    private String categoryName;

    @ExcelProperty("下单日期")
    private String createdAt;//最晚进场时间
    @ExcelProperty("下单人")
    private String creatorName;//创建人
    @ExcelProperty("状态")
    private String status;
    @ExcelProperty("备注")
    private String remark;


    public OrderExportResponse(
            Order order,
            Category category,
            Project project,
            ProjectUser creator
    ) {
        this.managementLevel = project.getManagementLevel();
        this.projectName = project.getName();
        this.no = order.getNo();
        this.categoryName = category.getName();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd");

        this.batchPlanNo = order.getBatchPlanNo();
        this.createdAt = order.getCreatedAt() == null ? null : simpleDateFormat.format(order.getCreatedAt());
        this.creatorName = creator == null ? null : creator.getName();
        this.status = order.getStatus().toString();
        this.remark = order.getRemark();
    }


    public String getManagementLevel() {
        return managementLevel;
    }

    public void setManagementLevel(String managementLevel) {
        this.managementLevel = managementLevel;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }


    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }


    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getBatchPlanNo() {
        return batchPlanNo;
    }

    public void setBatchPlanNo(String batchPlanNo) {
        this.batchPlanNo = batchPlanNo;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(String createdAt) {
        this.createdAt = createdAt;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }
}
